package com.trump.baiduim.service.impl;

import com.trump.baiduim.dao.MessageDao;
import com.trump.baiduim.dao.UserDao;
import com.trump.baiduim.model.Message;
import com.trump.baiduim.model.User;
import com.trump.baiduim.service.ImService;
import com.trump.baiduim.utils.EncryptUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

/**
 * @author guoyuans
 */
@Service
public class ImServiceImpl implements ImService {

    @Autowired
    private MessageDao messageDao;

    @Autowired
    private UserDao userDao;

    @Override
    public void insertMessage(Message message) {
        messageDao.insert(message);
    }

    @Override
    public LinkedList<Message> queryNoSendMessage(String messageReceiver) {
        return messageDao.queryNoSendMessage(messageReceiver);
    }

    @Override
    public void updateMessageStatus(Long messageId, Timestamp timestamp) {
        messageDao.updateMessageStatus(messageId,timestamp);
    }

    @Override
    public User findUserByAccount(String userAccount) {
        return userDao.selectByUserAccount(userAccount);
    }
}
